package com.ysd.lis.controller.sys;


import com.ysd.common.Result;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.dto.EditTableTodoParam;
import com.ysd.lis.dto.EditTableTodoParam2;
import com.ysd.lis.entity.SysBasDictTable;
import com.ysd.lis.request.CommonPageDto;
import com.ysd.lis.service.SysBasDictTableService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 员工表
 * 前端控制器
 * </p>
 *
 * @author LiuQi
 * @since 2023-10-19
 */
@Api(tags = "基础字典分类")
@RestController
@RequestMapping("/api/sys/basDictTable")
public class SysBasDictTableController extends BaseController {

    @Autowired
    SysBasDictTableService sysBasDictTableService;

    @ApiOperation("分页查询")
    @GetMapping("/findDictTablePageList")
    public Result findDictTablePageList(CommonPageDto pageParam){
        return sysBasDictTableService.findDictTablePageList(pageParam);
    }

    @ApiOperation("新增")
    @PostMapping("/addDictTable")
    public Result addDictTable(@RequestBody SysBasDictTable table){
        return  sysBasDictTableService.addDictTable(table);
    }

    @ApiOperation("修改")
    @PostMapping("/editDictTable")
    public Result editDictTable(@RequestBody SysBasDictTable table) {
        return sysBasDictTableService.editDictTable(table);
    }
    @ApiOperation("根据详情id删除详情数据")
    @PostMapping("/deleteDictTable")
    public Result deleteDictTable(@RequestBody SysBasDictTable dict) {
        return sysBasDictTableService.deleteDictTable(dict);
    }

    @ApiOperation("根据表名查询表字段")
    @GetMapping("/getTableColumns")
    public Result getTableColumns(CommonPageDto pageParam) {
        return sysBasDictTableService.getTableColumns(pageParam);
    }

    @ApiOperation("动态编辑模版实例表数据")
    @PostMapping("/editTableData")
    public Result editTableData(@RequestBody EditTableTodoParam editTableTodoParam) {
        return sysBasDictTableService.editTableData(editTableTodoParam);
    }

    @ApiOperation("动态插入模版实例表数据")
    @PostMapping("/addTableData")
    public Result addTableData(@RequestBody EditTableTodoParam2 editTableTodoParam) {
        return sysBasDictTableService.addTableData(editTableTodoParam);
    }
    @ApiOperation("通过表名和ID删除数据")
    @PostMapping("/deleteTableData")
    public Result deleteTableData(@RequestBody CommonPageDto pageParam) {
        return sysBasDictTableService.deleteTableData(pageParam);
    }

    @ApiOperation("模糊查询表名")
    @GetMapping("/findAllTableList")
    public Result findAllTableList(String seachValue) {
        return sysBasDictTableService.findAllTableList(seachValue);
    }

}
